package com.sh.data.engine.domain.integration.online.model.domain;

import com.sh.data.engine.domain.base.model.BaseDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.util.Date;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
public class FlinkDataSyncTaskDomain extends BaseDomain {

    private Integer xxlJobInfoId;

    private Integer xxlJobLogId;

    private Long projectId;

    /**
     * 任务名称
     */
    private String taskName;

    private Long dirId;

    /**
     * 任务描述
     */
    private String remark;

    /**
     * 来源数据源id
     */
    private Long sourceDsId;

    /**
     * 来源数据源类型
     */
    private String sourceDsType;

    /**
     * 目标数据源id
     */
    private Long targetDsId;

    /**
     * 来源数据源类型
     */
    private String targetDsType;

    private String sourceTableOrTopic;

    private String targetTableOrTopic;

    private Integer taskStatus;
    private Date startTime;
    private Date endTime;

    private String sourceDsName;

    private String targetDsName;

    private List<FieldMapping> fieldMappings;

    private Integer start;

    List<FieldExpresses> fieldExpressRequests;

    private Integer useJsFlag;

    private String jsContent;

    private List<String> tableData;

    private String sourceSchema;

    private String targetSchema;

    public FlinkDataSyncTaskDomain() {}

    @Data
    public static class FieldMapping {

        private String sourceField;

        private String sourceFieldType;

        private Integer isSourceFieldPk;

        private Integer isSourcePartition;

        private String targetField;

        private String targetFieldType;

        private Integer isTargetFieldPk;

        private Integer isTargetPartition;

        private Integer isTargetTag;

        private String sourceFieldExpress;
    }

    @Data
    public static class FieldExpresses {

        //        @ApiModelProperty("变量名")
        private String fieldName;

        //        @ApiModelProperty("变量表达式")
        private String fieldExpress;
    }
}
